<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!-- 全局变量 函数定义区 见top.jsp -->

<!-- 实例变量 函数定义区 -->
<%

String SYSTEMNAME="后台管理系统";
String path = request.getContextPath();
String baseurl = "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
String basePath = request.getScheme() +baseurl;

	//网页title
	String JSPTITLE = "登录";
	String url_reg = basePath + "reg.jsp";
	String url_forgot = basePath + "forgot.jsp";
%>
<%@ include file="pub/head2.jsp"%>
<script src="<%=basePath%>js/md5.js"></script>

<!-- 样式添加区 -->
<style>
</style>
</head>
<br>
<br>
<br>
<br>
<body class="login-layout">
	<div class="main-container">
		<div class="main-content">
			<div class="row">
				<div class="col-sm-10 col-sm-offset-1">
					<div class="login-container">
						<div class="center">
							<h1>
								<i class="ace-icon fa fa-leaf green"></i> <span class="white"
									id="id-text2" style="font-size: 14pt"><%=SYSTEMNAME%></span>
							</h1>
						</div>
						<div class="space-6"></div>
						<div class="position-relative">
							<div id="login-box"
								class="login-box visible widget-box no-border">
								<div class="widget-body">
									<div class="widget-main">
										<h4 class="header blue lighter bigger">
											<i class="ace-icon fa fa-coffee green"></i>
											<%=JSPTITLE%>
										</h4>
										<div class="space-6"></div>
										<form >
											<fieldset>
												<label class="block clearfix"> <span
													class="block input-icon input-icon-right"> <input
														type="text" id="user2" class="form-control"
														placeholder="用户id" /> <i class="ace-icon fa fa-user"></i>
												</span>
												</label> <label class="block clearfix"> <span
													class="block input-icon input-icon-right"> <input
														type="password" id="pass2" class="form-control"
														placeholder="密码" /> <i class="ace-icon fa fa-lock"></i>
												</span>
												</label> <label class="block clearfix"> <span
													class="block input-icon input-icon-right">  <a
														href="javascript:reloadVerifyCode('#image2');"> <img
															src="" alt="验证码" id="image2" /> <label>换一张</label>
													</a> <br><input
														type="text" class="form-control " id="code2"
														placeholder="验证码" />
												</span>
												</label>
												<div id="msg2"></div>
												<div class="space"></div>
												<div class="clearfix">
													<button  id="btn_login"
														class="width-100 pull-right btn btn-sm btn-primary">
														<i class="ace-icon fa fa-key"></i> <span
															class="bigger-110">登录</span>
													</button>
												</div>
												<div class="space-4"></div>
											</fieldset>
										</form>
									</div>
									<!-- /.widget-main -->
									<%-- <div class="toolbar clearfix">
										<div>
											<a href="<%=url_forgot%>" data-target="#forgot-box"
												class="forgot-password-link"> <i
												class="ace-icon fa fa-arrow-left"></i> 忘记密码
											</a>
										</div>
										<div>
											<a href="<%=url_reg%>" data-target="#signup-box"
												class="user-signup-link"> 新用户注册 <i
												class="ace-icon fa fa-arrow-right"></i>
											</a>
										</div>
									</div> --%>
								</div>
								<!-- /.widget-body -->
							</div>
							<!-- /.login-box -->

						</div>
						<!-- /.position-relative -->
						<div class="navbar-fixed-top align-right">
							<br /> &nbsp; <a id="btn-login-dark" href="#">Dark</a> &nbsp; <span
								class="blue">/</span> &nbsp; <a id="btn-login-blur" href="#">Blur</a>
							&nbsp; <span class="blue">/</span> &nbsp; <a id="btn-login-light"
								href="#">Light</a> &nbsp; &nbsp; &nbsp;
						</div>
					</div>
				</div>
				<!-- /.col -->
			</div>
			<!-- /.row -->
		</div>
		<!-- /.main-content -->
	</div>
	<!-- /.main-container -->
	<!-- inline scripts related to this page -->
	<script type="text/javascript">
	var URL_VERIFYCODE="<%=basePath%>ex/getVerifyCode";
	var URL_LOGIN="<%=basePath%>l/login";	
	var URL_TELEXIST="<%=basePath%>ex/telIsExist";
	var URL_IDEXIST="<%=basePath%>ex/idIsExist";
	var URL_MAIN="<%=basePath%>admin/main.jsp";
   // MSG_400="登录超时";
	//获取图片验证码
	function reloadVerifyCode(a) {
		var stamp = new Date().getTime();
		var qs = URL_VERIFYCODE + "?t=" + stamp; //+"&tokenid="+ COOK.get(COOK.idname);	
		$(a).attr("src", qs);
	}

		jQuery(function($) {
			
			//登录
			function login2(vbtn) {
				var vlabel = "#msg2";
				var param = {};
				param.name = $("#user2").val();
				param.pass = hex_md5($("#pass2").val());
				param.imgcode = $("#code2").val();
				// param.remember = $("#remember2:checked").val();    
				if (param.name == null || param.name == "") {
					$(vlabel).html("用户名必填");
					return;
				}
				if (param.pass == null || param.pass == "") {
					$(vlabel).html("密码不能为空");
					return;
				}
				if (param.imgcode == null || param.imgcode == "") {
					$(vlabel).html("验证码不能为空");
					return;
				}
				Chk.submit(URL_LOGIN, param, vbtn, function(result) {
					//alert(result);
					console.log(result);
					data = JSON.parse(result);
					//  
					if (data.CODE == 0) {
						$(vlabel).html(data.MSG);
						reloadVerifyCode('#image2');
					} else {
						window.location.href = URL_MAIN;
					}
				}, function(xhr, type, errorThrown) {
					//异常处理；
					$(vlabel).html(MSG_400);
					reloadVerifyCode('#image2');
				});
			}
		
			$('#btn_login').on('click', function(e) {
				login2('#btn_login');
				e.preventDefault();
			});
			$(document).on('click', '.toolbar a[data-target]', function(e) {
				e.preventDefault();
				var target = $(this).data('target');
				$('.widget-box.visible').removeClass('visible');//hide others
				$(target).addClass('visible');//show target
			});

			$('#btn-login-dark').on('click', function(e) {
				$('body').attr('class', 'login-layout');
				$('#id-text2').attr('class', 'white');
				$('#id-company-text').attr('class', 'blue');
				e.preventDefault();
			});
			$('#btn-login-light').on('click', function(e) {
				$('body').attr('class', 'login-layout light-login');
				$('#id-text2').attr('class', 'grey');
				$('#id-company-text').attr('class', 'blue');
				e.preventDefault();
			});
			$('#btn-login-blur').on('click', function(e) {
				$('body').attr('class', 'login-layout blur-login');
				$('#id-text2').attr('class', 'white');
				$('#id-company-text').attr('class', 'light-blue');
				e.preventDefault();
			});
			$(document).ready(function() {
				reloadVerifyCode('#image2')
			});
		});
	</script>
</body>
</html>

<!-- 扩展脚本 注入区 -->
